﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IRC.IRepairClouds.DataLayer;

[assembly: WebResource("IRC.IRepairClouds.WebClient.Cases.NewCase.debug.js", "text/javascript")]
[assembly: WebResource("IRC.IRepairClouds.WebClient.Cases.NewCase.js", "text/javascript")]

namespace IRC.IRepairClouds.WebClient.Cases
{
    public partial class NewCase : BasePages.BaseAuthPage
    {
        public override bool DisableViewstateCompletely
        {
            get { return true; }
        }

        public override bool RegisterIScripts
        {
            get { return true; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //RadGridHistory.ClientHidePager();
                using (ICloudRepairEntities db = new ICloudRepairEntities())
                {
                    var PhoneSets = (from ps in db.PhoneSet
                                     select new
                                     {
                                         Id = ps.Id,
                                         Name = ps.Name,

                                     });
                    var psets = PhoneSets.ToList();
                    RadComboBoxPhoneSet.Bind(psets, i => i.Name, i => i.Id.ToString());
                }
            }
        }

        public override IEnumerable<ScriptDescriptor> GetScriptDescriptors()
        {
            ScriptControlDescriptor descriptor = new ScriptControlDescriptor("IRC.Pages.Cases.NewCase", Page.Form.ClientID);
            descriptor.AddComponentProperty("mainOwner", Page.Form.ClientID);
            yield return descriptor;
        }

        public static IEnumerable<ScriptReference> GetScriptReferencesStatic()
        {
            yield return new ScriptReference("IRC.IRepairClouds.WebClient.Cases.NewCase.js", "IRC.IRepairClouds.WebClient");
        }

        public override IEnumerable<ScriptReference> GetScriptReferences()
        {
            return GetScriptReferencesStatic();
        }
    }
}